package io.renren.modules.efinance.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.efinance.entity.HistoryAccountflowEntity;
import io.renren.modules.efinance.service.HistoryAccountflowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author lhf
 * @email i@lhf.com
 * @date 2022-06-24 17:18:43
 */
@RestController
@RequestMapping("efinance/historyaccountflow")
public class HistoryAccountflowController {
    @Autowired
    private HistoryAccountflowService historyAccountflowService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("efinance:historyaccountflow:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = historyAccountflowService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{historyAccountflowId}")
    // @RequiresPermissions("efinance:historyaccountflow:info")
    public R info(@PathVariable("historyAccountflowId") Integer historyAccountflowId){
		HistoryAccountflowEntity historyAccountflow = historyAccountflowService.getById(historyAccountflowId);

        return R.ok().put("historyAccountflow", historyAccountflow);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("efinance:historyaccountflow:save")
    public R save(@RequestBody HistoryAccountflowEntity historyAccountflow){
		historyAccountflowService.save(historyAccountflow);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("efinance:historyaccountflow:update")
    public R update(@RequestBody HistoryAccountflowEntity historyAccountflow){
		historyAccountflowService.updateById(historyAccountflow);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("efinance:historyaccountflow:delete")
    public R delete(@RequestBody Integer[] historyAccountflowIds){
		historyAccountflowService.removeByIds(Arrays.asList(historyAccountflowIds));

        return R.ok();
    }

}
